#	-----------------------------------------------------------------------------------------
#   File Name:      drugwarplot.R                                                    
#   Author:         Omar García-Ponce and Thomas Zeitzoff                                   
#   Date:           June 27, 2020                                                 
#   Purpose:        Generate Figure 1 from "Are Voters too Afraid to Tackle Corruption?"                                                                                                                  
#   Machine:        Omar's MacBook Pro                                                
#	Software:         R
#	-----------------------------------------------------------------------------------------

rm(list=ls())

library(ggplot2)
library(foreign)

# Change working directory here

homds2 <- read.dta("homds1990_2011.dta")


pdf('figure1.pdf')  
ggplot(homds2, aes(year, homds_rate)) + theme_bw()+ 
  annotate("text", x = 2008, y = 28.5, label = "", size=5) +
  annotate("text", x = 2008, y = 27, label = "", size=5) +
  annotate("text", x = 2009, y = 27, label = "Drug War", size=5) +
  xlim(1990, 2011)  + ylim(0,30) + 
  ylab("Homicides per 100,000 people") + xlab("") + 
  xlab("Year") +
  geom_rect(xmin = 2007, xmax = 2011,
            ymin=0, ymax=Inf, alpha = .02, fill = "red",
            color= "#efefef")+
  geom_line(lwd=2) 
dev.off()


